Function input_sum_total(range_data As Range, Optional ByVal sign As String = "、")

Dim nameArr
Dim nameStr As String
Dim totalTime, outsourceTime As Double

'循环单元格
For Each r_str In range_data
    '判断单元格是否为空
    If r_str.Value <> "" Then
    nameStr = nameStr + r_str.Value + sign
    End If
Next

'去空格
nameStr = Replace(nameStr, " ", "")
'删除最后一位字符
nameStr = Left(nameStr, Len(nameStr) - 1)
'字符串转数组
nameArr = Split(nameStr, sign)

'循环数组
For Each strItem In nameArr
    Dim sartIndex As Integer
    Dim name As String
    
    '查找英文括号位置
    sartIndex = InStr(strItem, "(")
    '如果没有找到，则查找中文括号
    If sartIndex = 0 Then
       sartIndex = InStr(strItem, "（")
    End If
    
    '如果找到括号截取字符串
    If sartIndex > 0 Then
        Dim timeStr As String
        Dim time As Double
        
        index = InStr(Right(strItem, Len(strItem) - sartIndex), "外包")
        
        If index > 0 Then
            sartIndex = sartIndex + 2
        End If
        
        '截取括号内的数字字符串
        timeStr = Right(strItem, Len(strItem) - sartIndex)
        '去除最后的括号转换成Dobule类型的数字
        time = Val(Left(timeStr, Len(timeStr) - 1))
        
        If index > 0 Then
            outsourceTime = outsourceTime + time
        End If
        
        totalTime = totalTime + time
    End If
Next

input_sum_total = "total: " + CStr(totalTime) + " outsource: " + CStr(outsourceTime)

End Function